package com.small.xx.ai.spring.rag.processor;

import org.springframework.ai.document.Document;
import org.springframework.ai.rag.Query;
import org.springframework.ai.rag.postretrieval.document.DocumentPostProcessor;

import java.util.Collections;
import java.util.List;

public class DocumentSelectFirst implements DocumentPostProcessor {

    @Override
    public List<Document> process(Query query, List<Document> documents) {
        System.out.println("执行方法=============== DocumentSelectFirst.process ");
        System.out.println("query = " + query + ", documents = " + documents);
        System.out.println("执行方法=============== DocumentSelectFirst.process ");
//        return Collections.singletonList(documents.get(0));
        return documents;
    }
}
